﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace CityGateway.Objects
{

    [Serializable]
    [DataContract]

  public  class Population
    {

        public Population()
        {
            this.PopulationByYears = new Dictionary<int, int>();

        }

        [DataMember]
        public int ResidentialNeed;
        [DataMember]
        public int JobsNeed;
        [DataMember]
        public int HealthNeed;
        [DataMember]
        public int ProcreationAge;

        [DataMember]
        public int Total{
            get{

                List<int> pops = PopulationByYears.Values.ToList();
                int total = 0;
                foreach (int val in pops)
                {
                    total += val;
                }
                return total;
            
            }
            set { }
            }


        [DataMember]
        public Dictionary<int, int> PopulationByYears { get; set; }



        public override string ToString()
        {
            int res = 0;
            foreach(int i in PopulationByYears.Values)
                res+=i;

            return res.ToString();
        }
    }
}
